package com.bos.dao.repositories;
import com.bos.domian.base.Promotion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

/**
 * @author misterWei
 * @create 2018年11月13号:17点03分
 * @mailbox mynameisweiyan@gmail.com
 */
public interface PromotionRepository extends JpaRepository<Promotion,Integer> ,JpaSpecificationExecutor<Promotion> {

    //任务调度更新Status值
    @Query("update Promotion set status = '2' where  endDate < ?1 and status in (1)")
    @Modifying
    void uplodateStatus(Date date);
}
